<?
$host    = "127.0.0.1";
$port    = 1007;
$message = "RTG";
echo "Message To server :".$message;
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
// connect to server
$result = socket_connect($socket, $host, $port) or die("Could not connect to server\n");  
// send string to server

//$loop=0;
//while($loop++<30){
//	echo "loop:" .$loop;
	//socket_write($socket, $message, strlen($message)) or die("Could not send data to server\n");
	
	// get server response
	$result = socket_read ($socket, 2048) or die("Could not read server response\n");
	echo "\nReply From Server  :".$result;
	
//}

// close socket
socket_close($socket);


?>